//
//  File.swift
//  uwantgoeasy
//
//  Created by 冯传宝 on 12/17/15.
//  Copyright © 2015 uwantsoft. All rights reserved.
//

import Foundation

public class PublishListener {
    public init(){}
    final func onPublishResult(publishResult: PublishResult){
        if (MessageCode.OK.rawValue == publishResult.typeCode()) {
            onSuccess();
        } else if(MessageCode.UNAUTHORIZED.rawValue == publishResult.typeCode()) {
            onFailed(GoEasyError(code: 401,content: "Unauthorized"));
        }else if(MessageCode.INTERNAL_ERROR.rawValue == publishResult.typeCode()){
            onFailed(GoEasyError(code: 500,content: "Server internal error"));
        }
    }
    
    public func onSuccess(){}
    
    public func onFailed(error: GoEasyError){}
}